package com.lx.pc.service.goodssupply.impl;

import java.math.BigInteger;
import java.util.List;

import org.springframework.stereotype.Service;

import com.lx.pc.domain.entity.goodssupply.GoodssupplyEntity;
import com.lx.pc.domain.vo.goodssupply.GoodssupplyVo;
import com.lx.pc.mybatis.repository.goodssupply.GoodssupplyRepository;
import com.lx.pc.service.AbstractService;
import com.lx.pc.service.goodssupply.IGoodssupplyService;
import com.lx.pc.utils.OmsPage;
@Service("goodssupplyService")
public class GoodssupplyServiceImpl extends AbstractService<GoodssupplyEntity, GoodssupplyVo, BigInteger, GoodssupplyRepository> implements IGoodssupplyService{
	
	
	@Override
	public OmsPage<GoodssupplyVo> findByGoodssupply(
			GoodssupplyVo goodssupply, Integer page, Integer size) {
		
		OmsPage<GoodssupplyVo> pages = new OmsPage<GoodssupplyVo>();
		pages.setTotal(repository.findByGoodssupplyCount(goodssupply));
		List<GoodssupplyEntity> list = repository.findByGoodssupply(goodssupply, page = (page - 1) * size, size);
		pages.setResult(etoV(list));
		return pages;
	}
	
	@Override
	public GoodssupplyVo findByGoodssupplyId(BigInteger id) {
		
		 return etoV(repository.findByGoodssupplyId(id));
	}
	
}
